package com.xfy.mybatis.dao.impl;

import com.xfy.mybatis.dao.UserDao;
import com.xfy.mybatis.pojo.User;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

/**
 * Created by xiexie on 2017-9-3.
 */
public class UserDaoImpl implements UserDao{
    private SqlSession sqlSession;
    public UserDaoImpl(SqlSession sqlSession){
        this.sqlSession=sqlSession;
    }
    @Override
    public User queryUserById(Long id) {
        return sqlSession.selectOne("UserDaoMapper.queryUserById",id);
    }

    @Override
    public List<User> queryUserAll() {
        return null;
    }

    @Override
    public void insertUser(User user) {
        sqlSession.insert("UserDaoMapper.insertUser",user);
        sqlSession.commit();
    }

    @Override
    public void updateUser(User user) {

    }

    @Override
    public void deleteUserById(Long id) {
    sqlSession.delete("UserDaoMapper.deleteUserById",8L);
    }
}
